package com.freshcity.component.tooltip
{
	import flash.utils.*;

	public class NormalTooltip extends BackgroundTooltip
	{
		private var itemTooltip:ItemTooltip;
		private var labelToolTip:LabelToolTip;

		public function NormalTooltip()
		{
		}

		public override function set data(arg1:*):void
		{
			var loc1:*=null;
			var loc2:*=0;
			if (contentContainer && this.contains(contentContainer))
			{
				this.removeChild(contentContainer);
			}
			if (arg1 is String)
			{
				if (arg1 != "")
				{
					contentContainer=new LabelToolTip(arg1);
					this.addChild(contentContainer);
					super.data=arg1;
				}
			}
			else
			{
				loc1=arg1;
				if (this.itemTooltip)
				{
					this.itemTooltip.data=loc1;
				}
				else
				{
					this.itemTooltip=new ItemTooltip(loc1);
				}
				contentContainer=this.itemTooltip;

				this.addChild(contentContainer);
				this.updatePos();
				this.cacheAsBitmap=true;
			}
		}

		private function updatePos():void
		{
			this.updatePosLater();
			return;
		}

		private function updatePosLater():void
		{
			_width=contentContainer.width + paddingLeft + paddingRight;
			_height=contentContainer.height + paddingTop + paddingBottom;
			contentContainer.y=paddingTop;
			contentContainer.x=paddingLeft;
			super.updateSize(_width, _height);
		}

		public function dispose():void
		{
			if (this.contains(contentContainer))
			{
				this.removeChild(contentContainer);
			}
			return;
		}
	}
}
